#-*- coding: utf-8 -*-

import sys
from PySide2 import QtCore
from PySide2 import QtGui
from PySide2 import QtWidgets

class MyMainWindow(QtWidgets.QMainWindow):
    def __init__(self,parent=None):
        #继承父类
        QtWidgets.QMainWindow.__init__(self,parent)
        #自定义布局函数
        self.initUI()


    def initUI(self):
        # 窗口标题
        self.setWindowTitle("MainWindow")
        #窗口大小
        self.resize(400,400)

if __name__ == "__main__":
    app=QtWidgets.QApplication(sys.argv)
    myMainWindow=MyMainWindow()
    myMainWindow.show()
    sys.exit(app.exec_())